<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>10. Brief Tour of the Standard Library 标准库概览 &mdash; Python v2.7 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '2.7',
        COLLAPSE_MODINDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python v2.7 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python v2.7 documentation" href="../index.html" />
    <link rel="up" title="The Python Tutorial" href="index.html" />
    <link rel="next" title="11. Brief Tour of the Standard Library – Part II 标准库概览 II" href="stdlib2.html" />
    <link rel="prev" title="9. Classes 类" href="classes.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
 

  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             accesskey="M">modules</a> |</li>
        <li class="right" >
          <a href="stdlib2.html" title="11. Brief Tour of the Standard Library – Part II 标准库概览 II"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="classes.html" title="9. Classes 类"
             accesskey="P">previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.7 documentation</a> &raquo;</li>

          <li><a href="index.html" accesskey="U">The Python Tutorial</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="brief-tour-of-the-standard-library">
<span id="tut-brieftour"></span><h1>10. Brief Tour of the Standard Library 标准库概览<a class="headerlink" href="#brief-tour-of-the-standard-library" title="Permalink to this headline">¶</a></h1>
<div class="section" id="operating-system-interface">
<span id="tut-os-interface"></span><h2>10.1. Operating System Interface 操作系统接口<a class="headerlink" href="#operating-system-interface" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Miscellaneous operating system interfaces." class="reference external" href="../library/os.html#module-os"><tt class="xref docutils literal"><span class="pre">os</span></tt></a> module provides dozens of functions for interacting with the
operating system:</p>
<p><a title="Miscellaneous operating system interfaces." class="reference external" href="../library/os.html#module-os"><tt class="xref docutils literal"><span class="pre">os</span></tt></a> 模块提供了不少与操作系统相关联的函数</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">os</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">&#39;time 0:02&#39;</span><span class="p">)</span>
<span class="go">0</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">getcwd</span><span class="p">()</span>      <span class="c"># Return the current working directory</span>
<span class="go">&#39;C:\\Python26&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">os</span><span class="o">.</span><span class="n">chdir</span><span class="p">(</span><span class="s">&#39;/server/accesslogs&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Be sure to use the <tt class="docutils literal"><span class="pre">import</span> <span class="pre">os</span></tt> style instead of <tt class="docutils literal"><span class="pre">from</span> <span class="pre">os</span> <span class="pre">import</span> <span class="pre">*</span></tt>.  This
will keep <a title="os.open" class="reference external" href="../library/os.html#os.open"><tt class="xref docutils literal"><span class="pre">os.open()</span></tt></a> from shadowing the built-in <a title="open" class="reference external" href="../library/functions.html#open"><tt class="xref docutils literal"><span class="pre">open()</span></tt></a> function which
operates much differently.</p>
<p>应该用 <tt class="docutils literal"><span class="pre">import</span> <span class="pre">os</span></tt> 风格而非 <tt class="docutils literal"><span class="pre">from</span> <span class="pre">os</span> <span class="pre">import</span> <span class="pre">*</span></tt> 。这样可以保证随操作系统
不同而有所变化的 <a title="os.open" class="reference external" href="../library/os.html#os.open"><tt class="xref docutils literal"><span class="pre">os.open()</span></tt></a> 不会覆盖内置函数 <a title="open" class="reference external" href="../library/functions.html#open"><tt class="xref docutils literal"><span class="pre">open()</span></tt></a> 。</p>
<p id="index-1825">The built-in <a title="dir" class="reference external" href="../library/functions.html#dir"><tt class="xref docutils literal"><span class="pre">dir()</span></tt></a> and <a title="help" class="reference external" href="../library/functions.html#help"><tt class="xref docutils literal"><span class="pre">help()</span></tt></a> functions are useful as interactive
aids for working with large modules like <a title="Miscellaneous operating system interfaces." class="reference external" href="../library/os.html#module-os"><tt class="xref docutils literal"><span class="pre">os</span></tt></a>:</p>
<p>在使用一些像 <a title="Miscellaneous operating system interfaces." class="reference external" href="../library/os.html#module-os"><tt class="xref docutils literal"><span class="pre">os</span></tt></a> 这样的大型模块时内置的 <a title="dir" class="reference external" href="../library/functions.html#dir"><tt class="xref docutils literal"><span class="pre">dir()</span></tt></a> 和
<a title="help" class="reference external" href="../library/functions.html#help"><tt class="xref docutils literal"><span class="pre">help()</span></tt></a> 函数非常有用</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">os</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">dir</span><span class="p">(</span><span class="n">os</span><span class="p">)</span>
<span class="go">&lt;returns a list of all module functions&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">help</span><span class="p">(</span><span class="n">os</span><span class="p">)</span>
<span class="go">&lt;returns an extensive manual page created from the module&#39;s docstrings&gt;</span>
</pre></div>
</div>
<p>For daily file and directory management tasks, the <a title="High-level file operations, including copying." class="reference external" href="../library/shutil.html#module-shutil"><tt class="xref docutils literal"><span class="pre">shutil</span></tt></a> module provides
a higher level interface that is easier to use:</p>
<p>针对日常的文件和目录管理任务，:mod:<cite>shutil</cite> 模块提供了一个易于使用的高级接口</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">shutil</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">shutil</span><span class="o">.</span><span class="n">copyfile</span><span class="p">(</span><span class="s">&#39;data.db&#39;</span><span class="p">,</span> <span class="s">&#39;archive.db&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">shutil</span><span class="o">.</span><span class="n">move</span><span class="p">(</span><span class="s">&#39;/build/executables&#39;</span><span class="p">,</span> <span class="s">&#39;installdir&#39;</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="file-wildcards">
<span id="tut-file-wildcards"></span><h2>10.2. File Wildcards 文件通配符<a class="headerlink" href="#file-wildcards" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Unix shell style pathname pattern expansion." class="reference external" href="../library/glob.html#module-glob"><tt class="xref docutils literal"><span class="pre">glob</span></tt></a> module provides a function for making file lists from directory
wildcard searches:</p>
<p><a title="Unix shell style pathname pattern expansion." class="reference external" href="../library/glob.html#module-glob"><tt class="xref docutils literal"><span class="pre">glob</span></tt></a> 模块提供了一个函数用于从目录通配符搜索中生成文件列表</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">glob</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s">&#39;*.py&#39;</span><span class="p">)</span>
<span class="go">[&#39;primes.py&#39;, &#39;random.py&#39;, &#39;quote.py&#39;]</span>
</pre></div>
</div>
</div>
<div class="section" id="command-line-arguments">
<span id="tut-command-line-arguments"></span><h2>10.3. Command Line Arguments 命令行参数<a class="headerlink" href="#command-line-arguments" title="Permalink to this headline">¶</a></h2>
<p>Common utility scripts often need to process command line arguments. These
arguments are stored in the <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module&#8217;s <em>argv</em> attribute as a list.  For
instance the following output results from running <tt class="docutils literal"><span class="pre">python</span> <span class="pre">demo.py</span> <span class="pre">one</span> <span class="pre">two</span>
<span class="pre">three</span></tt> at the command line:</p>
<p>通用工具脚本经常调用命令行参数。这些命令行参数以链表形式存储于 <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> 模
块的 <em>argv</em> 变量。例如在命令行中执行 <tt class="docutils literal"><span class="pre">python</span> <span class="pre">demo.py</span> <span class="pre">one</span> <span class="pre">two</span> <span class="pre">three</span></tt> 后可
以得到以下输出结果</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">sys</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span>
<span class="go">[&#39;demo.py&#39;, &#39;one&#39;, &#39;two&#39;, &#39;three&#39;]</span>
</pre></div>
</div>
<p>The <a title="Portable parser for command line options; support both short and long option names." class="reference external" href="../library/getopt.html#module-getopt"><tt class="xref docutils literal"><span class="pre">getopt</span></tt></a> module processes <em>sys.argv</em> using the conventions of the Unix
<tt class="xref docutils literal"><span class="pre">getopt()</span></tt> function.  More powerful and flexible command line processing is
provided by the <a title="Command-line option and argument parsing library." class="reference external" href="../library/argparse.html#module-argparse"><tt class="xref docutils literal"><span class="pre">argparse</span></tt></a> module.</p>
<p><a title="Portable parser for command line options; support both short and long option names." class="reference external" href="../library/getopt.html#module-getopt"><tt class="xref docutils literal"><span class="pre">getopt</span></tt></a> 模块使用 Unix <tt class="xref docutils literal"><span class="pre">getopt()</span></tt> 函处理 <em>sys.argv</em> 。更多的
复杂命令行处理由 <a title="Command-line option parsing library. (deprecated)" class="reference external" href="../library/optparse.html#module-optparse"><tt class="xref docutils literal"><span class="pre">optparse</span></tt></a> 模块提供。</p>
</div>
<div class="section" id="error-output-redirection-and-program-termination">
<span id="tut-stderr"></span><h2>10.4. Error Output Redirection and Program Termination 错误输出重定向和程序终止<a class="headerlink" href="#error-output-redirection-and-program-termination" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> module also has attributes for <em>stdin</em>, <em>stdout</em>, and <em>stderr</em>.
The latter is useful for emitting warnings and error messages to make them
visible even when <em>stdout</em> has been redirected:</p>
<p><a title="Access system-specific parameters and functions." class="reference external" href="../library/sys.html#module-sys"><tt class="xref docutils literal"><span class="pre">sys</span></tt></a> 还有 <em>stdin</em> ， <em>stdout</em> 和 <em>stderr</em> 属性，即使在 <em>stdout</em> 被重定向时，后者
也可以用于显示警告和错误信息</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">sys</span><span class="o">.</span><span class="n">stderr</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="s">&#39;Warning, log file not found starting a new one</span><span class="se">\n</span><span class="s">&#39;</span><span class="p">)</span>
<span class="go">Warning, log file not found starting a new one</span>
</pre></div>
</div>
<p>The most direct way to terminate a script is to use <tt class="docutils literal"><span class="pre">sys.exit()</span></tt>.</p>
<p>大多脚本的定向终止都使用 <tt class="docutils literal"><span class="pre">sys.exit()</span></tt> 。</p>
</div>
<div class="section" id="string-pattern-matching">
<span id="tut-string-pattern-matching"></span><h2>10.5. String Pattern Matching 字符串正则匹配<a class="headerlink" href="#string-pattern-matching" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Regular expression operations." class="reference external" href="../library/re.html#module-re"><tt class="xref docutils literal"><span class="pre">re</span></tt></a> module provides regular expression tools for advanced string
processing. For complex matching and manipulation, regular expressions offer
succinct, optimized solutions:</p>
<p><a title="Regular expression operations." class="reference external" href="../library/re.html#module-re"><tt class="xref docutils literal"><span class="pre">re</span></tt></a> 模块为高级字符串处理提供了正则表达式工具。对于复杂的匹配和处理，正
则表达式提供了简洁、优化的解决方案</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">re</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">re</span><span class="o">.</span><span class="n">findall</span><span class="p">(</span><span class="s">r&#39;\bf[a-z]*&#39;</span><span class="p">,</span> <span class="s">&#39;which foot or hand fell fastest&#39;</span><span class="p">)</span>
<span class="go">[&#39;foot&#39;, &#39;fell&#39;, &#39;fastest&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">re</span><span class="o">.</span><span class="n">sub</span><span class="p">(</span><span class="s">r&#39;(\b[a-z]+) \1&#39;</span><span class="p">,</span> <span class="s">r&#39;\1&#39;</span><span class="p">,</span> <span class="s">&#39;cat in the the hat&#39;</span><span class="p">)</span>
<span class="go">&#39;cat in the hat&#39;</span>
</pre></div>
</div>
<p>When only simple capabilities are needed, string methods are preferred because
they are easier to read and debug:</p>
<p>只需简单的操作时，字符串方法最好用，因为它们易读，又容易调试</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="s">&#39;tea for too&#39;</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;too&#39;</span><span class="p">,</span> <span class="s">&#39;two&#39;</span><span class="p">)</span>
<span class="go">&#39;tea for two&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="mathematics">
<span id="tut-mathematics"></span><h2>10.6. Mathematics 数学<a class="headerlink" href="#mathematics" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Mathematical functions (sin() etc.)." class="reference external" href="../library/math.html#module-math"><tt class="xref docutils literal"><span class="pre">math</span></tt></a> module gives access to the underlying C library functions for
floating point math:</p>
<p><a title="Mathematical functions (sin() etc.)." class="reference external" href="../library/math.html#module-math"><tt class="xref docutils literal"><span class="pre">math</span></tt></a> 模块为浮点运算提供了对底层C函数库的访问</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">math</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">math</span><span class="o">.</span><span class="n">cos</span><span class="p">(</span><span class="n">math</span><span class="o">.</span><span class="n">pi</span> <span class="o">/</span> <span class="mf">4.0</span><span class="p">)</span>
<span class="go">0.70710678118654757</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">math</span><span class="o">.</span><span class="n">log</span><span class="p">(</span><span class="mi">1024</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="go">10.0</span>
</pre></div>
</div>
<p>The <a title="Generate pseudo-random numbers with various common distributions." class="reference external" href="../library/random.html#module-random"><tt class="xref docutils literal"><span class="pre">random</span></tt></a> module provides tools for making random selections:</p>
<p><a title="Generate pseudo-random numbers with various common distributions." class="reference external" href="../library/random.html#module-random"><tt class="xref docutils literal"><span class="pre">random</span></tt></a> 提供了生成随机数的工具</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">random</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">random</span><span class="o">.</span><span class="n">choice</span><span class="p">([</span><span class="s">&#39;apple&#39;</span><span class="p">,</span> <span class="s">&#39;pear&#39;</span><span class="p">,</span> <span class="s">&#39;banana&#39;</span><span class="p">])</span>
<span class="go">&#39;apple&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">random</span><span class="o">.</span><span class="n">sample</span><span class="p">(</span><span class="nb">xrange</span><span class="p">(</span><span class="mi">100</span><span class="p">),</span> <span class="mi">10</span><span class="p">)</span>   <span class="c"># sampling without replacement</span>
<span class="go">[30, 83, 16, 4, 8, 81, 41, 50, 18, 33]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">random</span><span class="o">.</span><span class="n">random</span><span class="p">()</span>    <span class="c"># random float</span>
<span class="go">0.17970987693706186</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">random</span><span class="o">.</span><span class="n">randrange</span><span class="p">(</span><span class="mi">6</span><span class="p">)</span>    <span class="c"># random integer chosen from range(6)</span>
<span class="go">4</span>
</pre></div>
</div>
</div>
<div class="section" id="internet-access">
<span id="tut-internet-access"></span><h2>10.7. Internet Access 互联网访问<a class="headerlink" href="#internet-access" title="Permalink to this headline">¶</a></h2>
<p>There are a number of modules for accessing the internet and processing internet
protocols. Two of the simplest are <a title="Next generation URL opening library." class="reference external" href="../library/urllib2.html#module-urllib2"><tt class="xref docutils literal"><span class="pre">urllib2</span></tt></a> for retrieving data from urls
and <a title="SMTP protocol client (requires sockets)." class="reference external" href="../library/smtplib.html#module-smtplib"><tt class="xref docutils literal"><span class="pre">smtplib</span></tt></a> for sending mail:</p>
<p>有几个模块用于访问互联网以及处理网络通信协议。其中最简单的两个是用于处
理从 <tt class="xref docutils literal"><span class="pre">urls</span></tt> 接收的数据的 <a title="Next generation URL opening library." class="reference external" href="../library/urllib2.html#module-urllib2"><tt class="xref docutils literal"><span class="pre">urllib2</span></tt></a> 以及用于发送电子邮件的
<a title="SMTP protocol client (requires sockets)." class="reference external" href="../library/smtplib.html#module-smtplib"><tt class="xref docutils literal"><span class="pre">smtplib</span></tt></a></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">urllib2</span>
<span class="gp">&gt;&gt;&gt; </span><span class="k">for</span> <span class="n">line</span> <span class="ow">in</span> <span class="n">urllib2</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="s">&#39;http://tycho.usno.navy.mil/cgi-bin/timer.pl&#39;</span><span class="p">):</span>
<span class="gp">... </span>    <span class="k">if</span> <span class="s">&#39;EST&#39;</span> <span class="ow">in</span> <span class="n">line</span> <span class="ow">or</span> <span class="s">&#39;EDT&#39;</span> <span class="ow">in</span> <span class="n">line</span><span class="p">:</span>  <span class="c"># look for Eastern Time</span>
<span class="gp">... </span>        <span class="k">print</span> <span class="n">line</span>

<span class="go">&lt;BR&gt;Nov. 25, 09:43:32 PM EST</span>

<span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">smtplib</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">server</span> <span class="o">=</span> <span class="n">smtplib</span><span class="o">.</span><span class="n">SMTP</span><span class="p">(</span><span class="s">&#39;localhost&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">server</span><span class="o">.</span><span class="n">sendmail</span><span class="p">(</span><span class="s">&#39;soothsayer@example.org&#39;</span><span class="p">,</span> <span class="s">&#39;jcaesar@example.org&#39;</span><span class="p">,</span>
<span class="gp">... </span><span class="sd">&quot;&quot;&quot;To: jcaesar@example.org</span>
<span class="gp">... </span><span class="sd">From: soothsayer@example.org</span>
<span class="gp">...</span><span class="sd"></span>
<span class="gp">... </span><span class="sd">Beware the Ides of March.</span>
<span class="gp">... </span><span class="sd">&quot;&quot;&quot;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">server</span><span class="o">.</span><span class="n">quit</span><span class="p">()</span>
</pre></div>
</div>
<p>(Note that the second example needs a mailserver running on localhost.)</p>
<p>(注意第二个例子需要在 localhost 运行一个邮件服务器。)</p>
</div>
<div class="section" id="dates-and-times">
<span id="tut-dates-and-times"></span><h2>10.8. Dates and Times 日期和时间<a class="headerlink" href="#dates-and-times" title="Permalink to this headline">¶</a></h2>
<p>The <a title="Basic date and time types." class="reference external" href="../library/datetime.html#module-datetime"><tt class="xref docutils literal"><span class="pre">datetime</span></tt></a> module supplies classes for manipulating dates and times in
both simple and complex ways. While date and time arithmetic is supported, the
focus of the implementation is on efficient member extraction for output
formatting and manipulation.  The module also supports objects that are timezone
aware. :</p>
<p><a title="Basic date and time types." class="reference external" href="../library/datetime.html#module-datetime"><tt class="xref docutils literal"><span class="pre">datetime</span></tt></a> 模块为日期和时间处理同时提供了简单和复杂的方法。支持日期和时
间算法的同时，实现的重点放在更有效的处理和格式化输出。该模块还支持时区
处理</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="c"># dates are easily constructed and formatted</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">datetime</span> <span class="kn">import</span> <span class="n">date</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">now</span> <span class="o">=</span> <span class="n">date</span><span class="o">.</span><span class="n">today</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">now</span>
<span class="go">datetime.date(2003, 12, 2)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">now</span><span class="o">.</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%m-</span><span class="si">%d</span><span class="s">-%y. </span><span class="si">%d</span><span class="s"> %b %Y is a %A on the </span><span class="si">%d</span><span class="s"> day of %B.&quot;</span><span class="p">)</span>
<span class="go">&#39;12-02-03. 02 Dec 2003 is a Tuesday on the 02 day of December.&#39;</span>

<span class="gp">&gt;&gt;&gt; </span><span class="c"># dates support calendar arithmetic</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">birthday</span> <span class="o">=</span> <span class="n">date</span><span class="p">(</span><span class="mi">1964</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">31</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">age</span> <span class="o">=</span> <span class="n">now</span> <span class="o">-</span> <span class="n">birthday</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">age</span><span class="o">.</span><span class="n">days</span>
<span class="go">14368</span>
</pre></div>
</div>
</div>
<div class="section" id="data-compression">
<span id="tut-data-compression"></span><h2>10.9. Data Compression 数据压缩<a class="headerlink" href="#data-compression" title="Permalink to this headline">¶</a></h2>
<p>Common data archiving and compression formats are directly supported by modules
including: <a title="Low-level interface to compression and decompression routines compatible with gzip." class="reference external" href="../library/zlib.html#module-zlib"><tt class="xref docutils literal"><span class="pre">zlib</span></tt></a>, <a title="Interfaces for gzip compression and decompression using file objects." class="reference external" href="../library/gzip.html#module-gzip"><tt class="xref docutils literal"><span class="pre">gzip</span></tt></a>, <a title="Interface to compression and decompression routines compatible with bzip2." class="reference external" href="../library/bz2.html#module-bz2"><tt class="xref docutils literal"><span class="pre">bz2</span></tt></a>, <a title="Read and write ZIP-format archive files." class="reference external" href="../library/zipfile.html#module-zipfile"><tt class="xref docutils literal"><span class="pre">zipfile</span></tt></a> and
<a title="Read and write tar-format archive files." class="reference external" href="../library/tarfile.html#module-tarfile"><tt class="xref docutils literal"><span class="pre">tarfile</span></tt></a>. :</p>
<p>以下模块直接支持通用的数据打包和压缩格式： <a title="Low-level interface to compression and decompression routines compatible with gzip." class="reference external" href="../library/zlib.html#module-zlib"><tt class="xref docutils literal"><span class="pre">zlib</span></tt></a> ， <a title="Interfaces for gzip compression and decompression using file objects." class="reference external" href="../library/gzip.html#module-gzip"><tt class="xref docutils literal"><span class="pre">gzip</span></tt></a>
， <a title="Interface to compression and decompression routines compatible with bzip2." class="reference external" href="../library/bz2.html#module-bz2"><tt class="xref docutils literal"><span class="pre">bz2</span></tt></a> ， <a title="Read and write ZIP-format archive files." class="reference external" href="../library/zipfile.html#module-zipfile"><tt class="xref docutils literal"><span class="pre">zipfile</span></tt></a> ， 以及 <a title="Read and write tar-format archive files." class="reference external" href="../library/tarfile.html#module-tarfile"><tt class="xref docutils literal"><span class="pre">tarfile</span></tt></a></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">zlib</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="s">&#39;witch which has which witches wrist watch&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">41</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">t</span> <span class="o">=</span> <span class="n">zlib</span><span class="o">.</span><span class="n">compress</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
<span class="go">37</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">zlib</span><span class="o">.</span><span class="n">decompress</span><span class="p">(</span><span class="n">t</span><span class="p">)</span>
<span class="go">&#39;witch which has which witches wrist watch&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">zlib</span><span class="o">.</span><span class="n">crc32</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
<span class="go">226805979</span>
</pre></div>
</div>
</div>
<div class="section" id="performance-measurement">
<span id="tut-performance-measurement"></span><h2>10.10. Performance Measurement 性能度量<a class="headerlink" href="#performance-measurement" title="Permalink to this headline">¶</a></h2>
<p>Some Python users develop a deep interest in knowing the relative performance of
different approaches to the same problem. Python provides a measurement tool
that answers those questions immediately.</p>
<p>有些用户对了解解决同一问题的不同方法之间的性能差异很感兴趣。Python 提
供了一个度量工具，为这些问题提供了直接答案。</p>
<p>For example, it may be tempting to use the tuple packing and unpacking feature
instead of the traditional approach to swapping arguments. The <a title="Measure the execution time of small code snippets." class="reference external" href="../library/timeit.html#module-timeit"><tt class="xref docutils literal"><span class="pre">timeit</span></tt></a>
module quickly demonstrates a modest performance advantage:</p>
<p>例如，使用元组封装和拆封来交换元素看起来要比使用传统的方法要诱人的多。
<a title="Measure the execution time of small code snippets." class="reference external" href="../library/timeit.html#module-timeit"><tt class="xref docutils literal"><span class="pre">timeit</span></tt></a> 证明了后者更快一些</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">timeit</span> <span class="kn">import</span> <span class="n">Timer</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Timer</span><span class="p">(</span><span class="s">&#39;t=a; a=b; b=t&#39;</span><span class="p">,</span> <span class="s">&#39;a=1; b=2&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">timeit</span><span class="p">()</span>
<span class="go">0.57535828626024577</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">Timer</span><span class="p">(</span><span class="s">&#39;a,b = b,a&#39;</span><span class="p">,</span> <span class="s">&#39;a=1; b=2&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">timeit</span><span class="p">()</span>
<span class="go">0.54962537085770791</span>
</pre></div>
</div>
<p>In contrast to <a title="Measure the execution time of small code snippets." class="reference external" href="../library/timeit.html#module-timeit"><tt class="xref docutils literal"><span class="pre">timeit</span></tt></a>&#8216;s fine level of granularity, the <a title="Python source profiler." class="reference external" href="../library/profile.html#module-profile"><tt class="xref docutils literal"><span class="pre">profile</span></tt></a> and
<a title="Statistics object for use with the profiler." class="reference external" href="../library/profile.html#module-pstats"><tt class="xref docutils literal"><span class="pre">pstats</span></tt></a> modules provide tools for identifying time critical sections in
larger blocks of code.</p>
<p>相对于 <a title="Measure the execution time of small code snippets." class="reference external" href="../library/timeit.html#module-timeit"><tt class="xref docutils literal"><span class="pre">timeit</span></tt></a> 的细粒度，:mod:<cite>profile</cite> 和 <a title="Statistics object for use with the profiler." class="reference external" href="../library/profile.html#module-pstats"><tt class="xref docutils literal"><span class="pre">pstats</span></tt></a> 模块提
供了针对更大代码块的时间度量工具。</p>
</div>
<div class="section" id="quality-control">
<span id="tut-quality-control"></span><h2>10.11. Quality Control 质量控制<a class="headerlink" href="#quality-control" title="Permalink to this headline">¶</a></h2>
<p>One approach for developing high quality software is to write tests for each
function as it is developed and to run those tests frequently during the
development process.</p>
<p>开发高质量软件的方法之一是为每一个函数开发测试代码，并且在开发过程中经常进行测试。</p>
<p>The <a title="Test pieces of code within docstrings." class="reference external" href="../library/doctest.html#module-doctest"><tt class="xref docutils literal"><span class="pre">doctest</span></tt></a> module provides a tool for scanning a module and validating
tests embedded in a program&#8217;s docstrings.  Test construction is as simple as
cutting-and-pasting a typical call along with its results into the docstring.
This improves the documentation by providing the user with an example and it
allows the doctest module to make sure the code remains true to the
documentation:</p>
<p><a title="Test pieces of code within docstrings." class="reference external" href="../library/doctest.html#module-doctest"><tt class="xref docutils literal"><span class="pre">doctest</span></tt></a> 模块提供了一个工具，扫描模块并根据程序中内嵌的文档字符串执行测
试。测试构造如同简单的将它的输出结果剪切并粘贴到文档字符串中。通过用户
提供的例子，它发展了文档，允许 doctest 模块确认代码的结果是否与文档一
致</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">def</span> <span class="nf">average</span><span class="p">(</span><span class="n">values</span><span class="p">):</span>
    <span class="sd">&quot;&quot;&quot;Computes the arithmetic mean of a list of numbers.</span>

<span class="sd">    &gt;&gt;&gt; print average([20, 30, 70])</span>
<span class="sd">    40.0</span>
<span class="sd">    &quot;&quot;&quot;</span>
    <span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">values</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span> <span class="o">/</span> <span class="nb">len</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>

<span class="kn">import</span> <span class="nn">doctest</span>
<span class="n">doctest</span><span class="o">.</span><span class="n">testmod</span><span class="p">()</span>   <span class="c"># automatically validate the embedded tests</span>
</pre></div>
</div>
<p>The <a title="Unit testing framework for Python." class="reference external" href="../library/unittest.html#module-unittest"><tt class="xref docutils literal"><span class="pre">unittest</span></tt></a> module is not as effortless as the <a title="Test pieces of code within docstrings." class="reference external" href="../library/doctest.html#module-doctest"><tt class="xref docutils literal"><span class="pre">doctest</span></tt></a> module,
but it allows a more comprehensive set of tests to be maintained in a separate
file:</p>
<p><a title="Unit testing framework for Python." class="reference external" href="../library/unittest.html#module-unittest"><tt class="xref docutils literal"><span class="pre">unittest</span></tt></a> 模块不像 <a title="Test pieces of code within docstrings." class="reference external" href="../library/doctest.html#module-doctest"><tt class="xref docutils literal"><span class="pre">doctest</span></tt></a> 模块那么容易使用，不过它可以在一个独立的文件
里提供一个更全面的测试集</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">unittest</span>

<span class="k">class</span> <span class="nc">TestStatisticalFunctions</span><span class="p">(</span><span class="n">unittest</span><span class="o">.</span><span class="n">TestCase</span><span class="p">):</span>

    <span class="k">def</span> <span class="nf">test_average</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="n">average</span><span class="p">([</span><span class="mi">20</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">70</span><span class="p">]),</span> <span class="mf">40.0</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">assertEqual</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">average</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">7</span><span class="p">]),</span> <span class="mi">1</span><span class="p">),</span> <span class="mf">4.3</span><span class="p">)</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="ne">ZeroDivisionError</span><span class="p">,</span> <span class="n">average</span><span class="p">,</span> <span class="p">[])</span>
        <span class="bp">self</span><span class="o">.</span><span class="n">assertRaises</span><span class="p">(</span><span class="ne">TypeError</span><span class="p">,</span> <span class="n">average</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">30</span><span class="p">,</span> <span class="mi">70</span><span class="p">)</span>

<span class="n">unittest</span><span class="o">.</span><span class="n">main</span><span class="p">()</span> <span class="c"># Calling from the command line invokes all tests</span>
</pre></div>
</div>
</div>
<div class="section" id="batteries-included">
<span id="tut-batteries-included"></span><h2>10.12. Batteries Included 电池已备<a class="headerlink" href="#batteries-included" title="Permalink to this headline">¶</a></h2>
<p>Python has a &#8220;batteries included&#8221; philosophy.  This is best seen through the
sophisticated and robust capabilities of its larger packages. For example:</p>
<p>Python 体现了“batteries included”哲学 <a class="footnote-reference" href="#id2" id="id1">[1]</a> 。Python 可以通过更大的包的来得
到应付各种复杂情况的强大能力，从这一点我们可以看出该思想的应用。例如：</p>
<ul>
<li><p class="first">The <a title="XML-RPC client access." class="reference external" href="../library/xmlrpclib.html#module-xmlrpclib"><tt class="xref docutils literal"><span class="pre">xmlrpclib</span></tt></a> and <a title="Basic XML-RPC server implementation." class="reference external" href="../library/simplexmlrpcserver.html#module-SimpleXMLRPCServer"><tt class="xref docutils literal"><span class="pre">SimpleXMLRPCServer</span></tt></a> modules make implementing
remote procedure calls into an almost trivial task.  Despite the modules
names, no direct knowledge or handling of XML is needed.</p>
<p><a title="XML-RPC client access." class="reference external" href="../library/xmlrpclib.html#module-xmlrpclib"><tt class="xref docutils literal"><span class="pre">xmlrpclib</span></tt></a> 和 <a title="Basic XML-RPC server implementation." class="reference external" href="../library/simplexmlrpcserver.html#module-SimpleXMLRPCServer"><tt class="xref docutils literal"><span class="pre">SimpleXMLRPCServer</span></tt></a> 模块实现了在琐碎的任务中调用远程过程。
尽管有这样的名字，其实用户不需要直接处理 XML ，也不需要这方面的知识。</p>
</li>
<li><p class="first">The <a title="Package supporting the parsing, manipulating, and generating email messages, including MIME documents." class="reference external" href="../library/email.html#module-email"><tt class="xref docutils literal"><span class="pre">email</span></tt></a> package is a library for managing email messages, including
MIME and other RFC 2822-based message documents. Unlike <a title="SMTP protocol client (requires sockets)." class="reference external" href="../library/smtplib.html#module-smtplib"><tt class="xref docutils literal"><span class="pre">smtplib</span></tt></a> and
<a title="POP3 protocol client (requires sockets)." class="reference external" href="../library/poplib.html#module-poplib"><tt class="xref docutils literal"><span class="pre">poplib</span></tt></a> which actually send and receive messages, the email package has
a complete toolset for building or decoding complex message structures
(including attachments) and for implementing internet encoding and header
protocols.</p>
<p><a title="Package supporting the parsing, manipulating, and generating email messages, including MIME documents." class="reference external" href="../library/email.html#module-email"><tt class="xref docutils literal"><span class="pre">email</span></tt></a> 包是一个邮件消息管理库，可以处理 MIME 或其它基于 RFC 2822 的消
息文档。不同于实际发送和接收消息的 <a title="SMTP protocol client (requires sockets)." class="reference external" href="../library/smtplib.html#module-smtplib"><tt class="xref docutils literal"><span class="pre">smtplib</span></tt></a> 和 <a title="POP3 protocol client (requires sockets)." class="reference external" href="../library/poplib.html#module-poplib"><tt class="xref docutils literal"><span class="pre">poplib</span></tt></a> 模块，email 包
有一个用于构建或解析复杂消息结构（包括附件）以及实现互联网编码和头协
议的完整工具集。</p>
</li>
<li><p class="first">The <a title="Document Object Model API for Python." class="reference external" href="../library/xml.dom.html#module-xml.dom"><tt class="xref docutils literal"><span class="pre">xml.dom</span></tt></a> and <a title="Package containing SAX2 base classes and convenience functions." class="reference external" href="../library/xml.sax.html#module-xml.sax"><tt class="xref docutils literal"><span class="pre">xml.sax</span></tt></a> packages provide robust support for
parsing this popular data interchange format. Likewise, the <a title="Write and read tabular data to and from delimited files." class="reference external" href="../library/csv.html#module-csv"><tt class="xref docutils literal"><span class="pre">csv</span></tt></a> module
supports direct reads and writes in a common database format. Together, these
modules and packages greatly simplify data interchange between Python
applications and other tools.</p>
<p><a title="Document Object Model API for Python." class="reference external" href="../library/xml.dom.html#module-xml.dom"><tt class="xref docutils literal"><span class="pre">xml.dom</span></tt></a> 和 <a title="Package containing SAX2 base classes and convenience functions." class="reference external" href="../library/xml.sax.html#module-xml.sax"><tt class="xref docutils literal"><span class="pre">xml.sax</span></tt></a> 包为流行的信息交换格式提供了强大的支持。同样，
<a title="Write and read tabular data to and from delimited files." class="reference external" href="../library/csv.html#module-csv"><tt class="xref docutils literal"><span class="pre">csv</span></tt></a> 模块支持在通用数据库格式中直接读写。综合起来，这些模块和包大大简
化了 Python 应用程序和其它工具之间的数据交换。</p>
</li>
<li><p class="first">Internationalization is supported by a number of modules including
<a title="Multilingual internationalization services." class="reference external" href="../library/gettext.html#module-gettext"><tt class="xref docutils literal"><span class="pre">gettext</span></tt></a>, <a title="Internationalization services." class="reference external" href="../library/locale.html#module-locale"><tt class="xref docutils literal"><span class="pre">locale</span></tt></a>, and the <a title="Encode and decode data and streams." class="reference external" href="../library/codecs.html#module-codecs"><tt class="xref docutils literal"><span class="pre">codecs</span></tt></a> package.</p>
<p>国际化由 <a title="Multilingual internationalization services." class="reference external" href="../library/gettext.html#module-gettext"><tt class="xref docutils literal"><span class="pre">gettext</span></tt></a> ， <a title="Internationalization services." class="reference external" href="../library/locale.html#module-locale"><tt class="xref docutils literal"><span class="pre">locale</span></tt></a> 和 <a title="Encode and decode data and streams." class="reference external" href="../library/codecs.html#module-codecs"><tt class="xref docutils literal"><span class="pre">codecs</span></tt></a> 包支持。</p>
</li>
</ul>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>batteries included 是一个商业用语，印在玩具之类的商品上，表示产品中附有电池，开箱可用。——译注</td></tr>
</tbody>
</table>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <h3><a href="../contents.html">Table Of Contents</a></h3>
            <ul>
<li><a class="reference external" href="#">10. Brief Tour of the Standard Library 标准库概览</a><ul>
<li><a class="reference external" href="#operating-system-interface">10.1. Operating System Interface 操作系统接口</a></li>
<li><a class="reference external" href="#file-wildcards">10.2. File Wildcards 文件通配符</a></li>
<li><a class="reference external" href="#command-line-arguments">10.3. Command Line Arguments 命令行参数</a></li>
<li><a class="reference external" href="#error-output-redirection-and-program-termination">10.4. Error Output Redirection and Program Termination 错误输出重定向和程序终止</a></li>
<li><a class="reference external" href="#string-pattern-matching">10.5. String Pattern Matching 字符串正则匹配</a></li>
<li><a class="reference external" href="#mathematics">10.6. Mathematics 数学</a></li>
<li><a class="reference external" href="#internet-access">10.7. Internet Access 互联网访问</a></li>
<li><a class="reference external" href="#dates-and-times">10.8. Dates and Times 日期和时间</a></li>
<li><a class="reference external" href="#data-compression">10.9. Data Compression 数据压缩</a></li>
<li><a class="reference external" href="#performance-measurement">10.10. Performance Measurement 性能度量</a></li>
<li><a class="reference external" href="#quality-control">10.11. Quality Control 质量控制</a></li>
<li><a class="reference external" href="#batteries-included">10.12. Batteries Included 电池已备</a></li>
</ul>
</li>
</ul>

            <h4>Previous topic</h4>
            <p class="topless"><a href="classes.html"
                                  title="previous chapter">9. Classes 类</a></p>
            <h4>Next topic</h4>
            <p class="topless"><a href="stdlib2.html"
                                  title="next chapter">11. Brief Tour of the Standard Library &#8211; Part II 标准库概览 II</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
  <li><a href="../bugs.html">Report a Bug</a></li>
  <li><a href="../_sources/tutorial/stdlib.txt"
         rel="nofollow">Show Source</a></li>
</ul>

          <div id="searchbox" style="display: none">
            <h3>Quick search</h3>
              <form class="search" action="../search.html" method="get">
                <input type="text" name="q" size="18" />
                <input type="submit" value="Go" />
                <input type="hidden" name="check_keywords" value="yes" />
                <input type="hidden" name="area" value="default" />
              </form>
              <p class="searchtip" style="font-size: 90%">
              Enter search terms or a module, class or function name.
              </p>
          </div>
          <script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../modindex.html" title="Global Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="stdlib2.html" title="11. Brief Tour of the Standard Library – Part II 标准库概览 II"
             >next</a> |</li>
        <li class="right" >
          <a href="classes.html" title="9. Classes 类"
             >previous</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="../index.html">Python v2.7 documentation</a> &raquo;</li>

          <li><a href="index.html" >The Python Tutorial</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 1990-2010, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.  
    <a href="http://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on Oct 04, 2010.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.5.
    </div>

  </body>
</html>